約 2,526,167 件
https://w.atwiki.jp/eroscape_bibouroku/pages/156.html
SQLの実行コスト WHERE句の活用 さて、以下は、ゲーム名/中央値/ユーザーの得点/登録日/ユーザー名を取得するために、ゲームリスト(gamelist)とユーザーレビュー(userreview)をゲームIDで連携させて、登録日の新しい順かつゲームのフリガナ順で、100件のデータを返すSQLのサンプルです。 SELECT gl.gamename, gl.median, ur.tokuten, ur.tourokubi, ur.uid FROM gamelist AS gl, userreview AS ur WHERE gl.id = ur.game ORDER BY ur.tourokubi DESC, gl.furigana LIMIT 100 実行コストは、(cost=59640.11..59640.36 rows=100 width=73)となり、コスト制限の60000ギリギリで動作しました。(※2010/11/27現在) ですが、これはいつ60000を超えてもおかしくありません。ゲームが新しく追加され、レビューが新しく追加される度に、実行コストは増加していきます。参照するデータ量の増加と、実行コストの増加は直結しているわけです。 では、参照するデータを減らしてあげれば、当然、実行コストも下がるわけです。 userreviewテーブルには未プレイの情報も格納されています。今回の場合、未プレイで得点のないデータを参照しても意味がありません。 よって、WHERE句で「プレイ済みに限る」という条件を追加します。 (ur.play = TRUE 既存のSQLでよく見かける、ur.tokuten IS NOT NULLだと、プレイ済みで点数無しのデータも無視してしまいます。) 次に、userreviewテーブルへの書き込みをSQLで調べると、平均185件/日となっています。今回、出力したいのは、新着100件ですので余裕を見ても一週間程度の期間のデータに絞り込めば充分だという予想が出来ます。 よって、WHERE句で「登録日が現在から遡って7日以内」という条件を追加します。 (ur.tourokubi CURRENT_DATE - CAST( 7 days AS interval) 日時の演算は、CURRENT_DATE - 7 とするよりもCASTを使って型変換した方が良い。※暗黙の型変換は避ける) SELECT gl.gamename, gl.median, ur.tokuten, ur.tourokubi, ur.uid FROM gamelist AS gl, userreview AS ur WHERE gl.id = ur.game AND ur.play = TRUE AND ur.tourokubi CURRENT_DATE - CAST( 7 days AS INTERVAL) ORDER BY ur.tourokubi DESC, gl.furigana LIMIT 100 これで実行コストは、(cost=2083.39..2083.64 rows=100 width=73)となりました。実行コスト制限なんて余裕ですね。 【管理】POSTボタンを生成しました。
https://w.atwiki.jp/optimuslte/pages/17.html
各種モード ■ダウンロードモード USB挿す+ボリュームダウン+電源 ■初期化モード(/data下をクリアするだけです) ボリュームアップ+電源 ■テスト中モード モバイルネットワークをOFF→ダイヤルパットで「*#*#4636#*#*」 font入替 入れたいフォントファイルを/sdcard/配下にでも置いておく。 pcからadbで、remount、cpとmv(root化の手順を参考に)を使って、バックアップを残す。 /sdcard/下に用意したファイルをフォントのディレクトリにコピー。 lsでパーミッションなどを一応確認 携帯再起動 バッテリーアイコン変更 以下のリンク先を参考にapkを作成し、差し替えます。その後再起動すれば新しいアイコンになります。 (リンク先の説明は直接的差し替えではなくシンボリックリンクを使用した方法) またリンク先の解説ではdrawable-hdpiフォルダへ画像を差し替えるよう書いてありますが、drawable-xhdpiにもバッテリアイコンが入っているためどちらも差し替える必要があります。 念のため、元のapkをframework-res.apk_などにmvして残しておき、差し替えるapkのpermissionも元のapkと同じ(644)(rw-r--r--)に揃えて、ファイル名も間違っていないか確認してから再起動しましょう。 またapk差し替えると、アカウントと同期に表示されているアカウントが全て消えます。壁紙も標準に戻ります。そのため、それらを手作業などで戻す必要があります。 http //www.kanepee.jp/golvari/?p=109 各種日本語 framework-res.apk\res\values-ja\strings.xml hosts root化したのみで端末上から更新しようとするとリブートがかかってしまいます。 root化に記載のmountの差し替えで、端末上(のESエクスプローラなど)から更新しても、リブートしないようになります。 adaway、adfreeなどでhostsファイルを更新してもリブートしなくなります。 標準カメラアプリ無音化 ■propを更新する方法 /system/build.prop の ro.camera.sound.forced を 1→0 に書き換える。 (こちらの場合、端末のボリューム設定が0のときに無音になる=Android の標準動作) /data/local.prop に書いても有効になりません。 (local.prop に ro.kernel.qemu=1 がある状態だとBTが使えなくなったりの副作用の一つでカメラのシャッター音も消えるが、ro.camera.sound.forced=0 の効果ではない) ■apkを差し替える方法 /System/App/CameraApp.apk抜く ApkManagerでapk圧縮レベルを0にした後デコンパイル→コンパイル SystemApp?→y copy original files?→y 何かキーを...でkeepフォルダ内、 res/raw の*.oggを全て無音ファイルのoggに コンパイル再開 ApkManagerでそのまま署名 signedCameraApp.apkを/System/App/CameraApp.apkにコピー これでbuild.propやlocal.propに手を加えなくても無音になる。(build.prop local.prop弄った人は元に戻す) /system/media/audio/ui内のファイルもデフォルトのままでおk。 爆速スクロール改善 build.propのuser.feature.scrollerをfalse 電源投入時の起動音を無くす /system/media/audio/ui/PowerOn.oggをリネームする moperaでテザリング APNをmoperaにしていても公式テザリングをONにするとAPNは強制的にSPモードになってしまいます。 /data/local.propに"lge.docomo.tether.apn=mopera.net"と追記すればmoperaでテザリングすることができます。 moperaテザリング(ICS) ○バックアップ方法 adb shell _su busybox tar zcf /sdcard/data_20121026-spmode.tar.gz /data こんなワーニングが多少出るが気にしない。 tar removing leading / from member names tar /data/misc/wifi/sockets/wpa_ctrl_417-2 socket ignored tar /data/misc/wifi/sockets/wpa_ctrl_417-1 socket ignored tar /data/misc/wifi/hostapd/wlan0 socket ignored tar /data/inc_data_path socket ignored 無事終了したら、バックアップ終了 ○mopera有効化 adb reboot adb wait-for-device shell 接続したら急いで、 _su stop busybox cp /data/data/com.android.providers.settings/databases/settings.db /data/data/com.android.providers.settings/databases/settings.db.orig sqlite3を何らかの方法で入れれば良いのだけど、みんなTitaniumBackupもってるよね? /data/data/com.keramidas.TitaniumBackup/files/sqlite3 /data/data/com.android.providers.settings/databases/settings.db こっからさき、プロンプトがsqlite になっているハズ。 select name,value from secure where name= tether_dun_required order by name; こんなのがでるはず。多分、1だとダイアルアップを切り替えちゃうよっていう意味。 tether_dun_required|1 update secure set value = 0 where name = tether_dun_required ; 念のため、確認 select name,value from secure where name= tether_dun_required order by name; tether_dun_required|0 おっけー次。 select name,value from secure where name= tether_dun_apn order by name; テザリングのAPNを指定するもの。多分何も出てこないのでinsertする。 insert into secure ( name,value ) values ( tether_dun_apn , docomo tethering,mopera.net,,,,,,,,,440,10,0,* ) ; 確認 select name,value from secure where name= tether_dun_apn order by name; 192|tether_dun_apn|docomo tethering,mopera.net,,,,,,,,,440,10,0,* .quit おわったらadbからexitして、 adb reboot なんどか再起動してHOMEがしななかったり、moperaが動くかどうかを確認してみましょう。 上手くいったら、上の方法でもう一度バックアップでおすすめ!別ファイル名にバックアップするように! ○リストア方法 失敗してリストアしたくなったら adb reboot adb wait-for-device shell 接続したら急いで、 _su stop を入力して止める。 cd /data ; rm -r * ちなみに、この状態でリブートすると、ファクトリーリセットとほぼ同じ状態になる ) CWM試しに入れて、ファクトリーリセットできなくなって困った人はどうぞ。 cd / mount -t vfat /dev/block/vold/179 33 /mnt/sdcard ls -l /sdcard で、sdcardの中身を確認する。 busybox tar zxf /sdcard/data_20121026-spmode.tar.gz これが終了したら、復元可能。 あとはexitしてadb rebootすればOK! 画面解像度を擬似的に変更 解像度を大きく(値を小さく)しすぎると起動できなくなるので注意。 /data/local.propに"ro.sf.lcd_density= 数値 "を追記する。 ro.sf.lcd_density=220までは確認済み。 BLNっぽいもの(要root) NoLEDやiLEDは常に液晶がONになってしまうため電池の持ちが悪くなってしまいます。 LG Touch LED Notificationsは、画面下部のメニュー、ホーム、戻るボタンの部分を光らせることができるアプリです。 不在着信、SMS、Gmail、SPモードメール等の通知に対応しています。 LTE切断(v10b) LTE切断方法の報告です。 今回見つけた方法で7回中6回切断に成功しました。 環境や製造ロットに依存しないかLTEエリアの方は確認していただけないでしょうか? 方法は以下のとおりです。 ①モバイルネットワークOFF ②ホームからメニュー→設定→無線とネットワーク→モバイルネットワーク→ネットワークモードを選択 ③優先ネットワークモードを自動→GSMのみに変更 ④電話のダイヤルから→「*#*#4636#*#*」→携帯電話情報 ⑤通常だとGSM auto(PRL)になっているが、GSM onlyになっているのを確認 ⑥GSM only→WCDMA onlyに変更して戻る ⑦モバイルネットワークON これで自分の環境ではLTEが切断、3G固定に出来ました。 失敗した1回は⑤でGSM onlyに切り替わっていなかったようです。 その場合は戻って優先ネットワークモードがGSMのみに切り替わっているのを確認して下さい。 それでは確認結果を待っています。 どうやらLTE切断は出来るようで一安心です。 しかし、基本的にネットワークOFFはしないで運用していたので気づきませんでしたが、 ネットワークOFF→ONで優先ネットワークが自動に切り替わりLTEを掴んでしまうみたいですね。 一応回避方法は見つけたので報告しますが根本的な対策ではないのであしからず。 方法は、 モバイルネットワークをONする前に②のネットワークモードで優先ネットワークモードが「GSMのみ」であることを確認する(確認したらキャンセルする)。 だけです。そのままモバイルネットワークをONすれば3G固定のままONできます。 ちなみに機内モードON/OFFではLTEに切り替わらないようです。 ↑をしたあと再起動したらFOMA契約のSIMも認識した。既出かもしれないけど一応報告まで。
https://w.atwiki.jp/mw_wing/pages/79.html
CALLofDUTY ELITEのクラン登録が完了いたしました。 クランメンバーの皆様も登録をお願いします。 手順http //www.callofduty.com/elite を開き、右上にある「SIGN UP」 をクリックしてください。 必要事項を記入してください。Eメールアドレスは最後に.jpがつくものでは登録できません。Gメールなどを使うようにその後、先ほど記入したEメールアドレスに メールが届いているので、 そこに載っているアドレスをクリックしてください。メールアドレスとパスワードを入力しログイン。 右上のMy account→Profileをクリックしてください。 Consoleの項目からPSN (プレイステーションネットワーク) のマークをクリック。 PSNにログイン。 うまくいけば、XP2倍(2時間)と エンブレム&タイトルが追加されてます。 エリートクランへの入隊なのですが 我々のクラン[WING]は CLAN WING という名前で登録しています。 CALLofDUTY ELITEに登録できたら、 すぐを教えてください。 クランへの招待をします。http //framk.blog71.fc2.com/blog-entry-149.htmlクランを作成できる。クランは掛け持ち出来ず、 1つにしか所属できない。 他の人の作ったクランに入るには、 作った人から招待を受けなければいけない。 招待を受けるとCAREERのELITE SUMMARY のとこのFeedのInvitesに表示される。 Acceptが承認、Declineが拒否。 クランに入るとクランのページが Clanの左に追加され、そのページで * クランレベルとXP * クラン内累計プレイ時間 * クラン内キルレシオ * クラン内SPM * クラン名簿 * クラン内ランキング * クラン内メダルリスト をチェックできる。 クランのレベルは * Clan Challenges * Clan Operations(プレミアムメンバー限定) をクリアすることでクランXPを獲得でき、 レベルが上昇する。 クランレベル10ごとにXP2倍が一定時間賞与され、 レベル50ではプレステージトークンも賞与される。 また、クランレベルの上昇 によって好きな英単語を入れたタイトルを 作成する事も可能になる。http //www.cyac.jp/wiki/call-of-duty-mw3/23071#Clanhttp //framk.blog71.fc2.com/blog-entry-150.html
https://w.atwiki.jp/cso_weaponbattle/pages/37.html
.40 Dual Elites 総体力:62 攻撃力:31 防御力:86 破壊力:70 瞬発力:75 攻回数:5 全ての能力においてバランスが取れた良武器である。これを選ぶのは決して間違いでは無い。
https://w.atwiki.jp/switchsoft/pages/1841.html
Sparklite 上方視点ACT ACTADV スチームパンクゼルダ ローグライク プレイ人数× 1 ~ 2 2,570円(税込)1.3GB 世界を変える力を秘めた鉱石の物語 揺れる大地を冒険するアクションアドベンチャー! ――強大な力を秘めた鉱石「スパークライト」 「男爵」と呼ばれる男が、それを利用して世界を作り変える力を手に入れようとしている! スパークライトを使い続ければ、穏やかだった生き物がミュータントやグレムリンとなり、自然の姿がボロボロになってしまうんだ…。 冒険の舞台となる「ジオディア」へと降り立ち、そこに暮らす人々を助けながら男爵の野望を食い止める旅に出よう! ジオディアの土地は定期的に地震で変化してしまうから、キミ自身の経験こそが強力な武器の1つになるはずだ。 いろいろな能力を持った「ガジェット」の発明も忘れずにね! 『Sparklite』は、世界を変える力を持つスパークライトをめぐるアクションアドベンチャーゲームだ! <ゲームの特徴> ◆揺れる大地で男爵の野望を食い止めよう! 危険なダンジョンやユニークな地域を探検しながら、 スパークライトを利用した男爵の兵器「タイタン」を見つけ出そう。 冒険の途中で力尽きると大きな地震が起きて、 ジオディアの地形が変わってしまうから注意が必要だ! ◆冒険を手助けするガジェットとパッチ ボウガン、爆弾を運ぶ風船、自分の体を小さくする装置… さまざまな力を持った「ガジェット」を発明してみよう! さらに、医療施設で「パッチ」を装着すれば体力や攻撃力がアップ! 冒険が上手くいくような自分なりのカスタマイズを考えよう! メーカー Merge Games 配信日 2019年11月14日 対応ハード Nintendo Switch セーブデータお預かり対応 対応コントローラー Nintendo Switch Proコントローラー タッチスクリーン プレイモード TVモード, テーブルモード, 携帯モード プレイ人数× 1 ~ 2 対応言語 日本語, 英語, スペイン語, フランス語, ドイツ語, 中国語 レーティング CERO A 2019年11月20日 23 59 まで割引価格でお買い求めいただけます。 スパークライト良くできてるわ -- 名無しさん (2019-12-01 16 47 29) スパークライトはパッチパネル広げるまで行けるとグッと気楽になるね 序盤は三発で死んでつらい -- 名無しさん (2019-12-01 16 47 39) sparklite結構面白いね 武器と商売のないムーンライターみたい たまにバグってキャラが画面外行ったりして操作不能になるけど、すぐやり直せるし でもこれ死なないと町に戻れないのかな? -- 名無しさん (2019-12-01 16 47 50) スパークライトクリアしたけど思ったより小ぢんまりとしたゲームだった まとまってはいる -- 名無しさん (2019-12-01 16 48 01) スパークライトいい感じだけど初期ライフの低さが辛くないですかね… あとランダム生成のフィールド出るときロードがちと長い -- 名無しさん (2019-12-01 16 48 59) sparklite色々惜しいゲームだ絵や音はいいんだけど序盤だけ難しくてそれ以降はダレるバランスなのが難点 収集要素もあるがラスボス倒して終わりにしよう -- 名無しさん (2019-12-15 21 04 59) ゼルダ系見下ろしローグライトアクションRPG グラフィックや音楽は良いがシステム面とボリューム面で不満 操作もダッシュ後の硬直が鬱陶しかったり連続斬りすると後ろ向いてたり飛び道具の狙いがつけづらく ゼルダの祠のような場所で新しいアイテムが手に入るが実際に使うのにお金が必要だったり、 そのお金も溜まりづらかったりちょいちょいイライラさせられる もう少し練れば名作になっただろう惜しい作品 -- 名無しさん (2020-05-19 18 06 00) 名前 コメント
https://w.atwiki.jp/wiki8_m2/pages/14.html
13.1 SQL*Plus 【SQL*Plusの主な特徴】 SQLを対話形式で簡単に実行するためのアプリケーション 入力されたSQLをOracleサーバーへ送り、oRACLEサーバーから戻されたデータを編集(列見出しを付けるなど)して表示する。 【SQL*Plusコマンドの主な特徴】 データベース内のデータを直接操作できない(SQLだけがデータを操作できる) SQLを実行するための環境の設定、ファイル処理、SQLバッファの編集などを行う。 キーワードの短縮形がサポートされている。 Oracle独自の技術である。 13.2 SQLコマンドについて(一例) ◆SAVE・・・SQLバッファ内のSQL文をファイルに保存する →SAVE ファイル名 APPEND | REPRACE ◆DESCRIBE・・・表の定義を確認する。 →DESCRIBE 表名 ◆GET・・・ファイル内の内容をSQLバッファにロードする。 →GET ファイル名 13.3 バッファ内SQL文の編集 SQL*Plusは、入力したSQLコマンドをSQLバッファと呼ばれる領域に格納する。 新たなSQLコマンドが入力されるまで保持する。 SQL*Plusで最後に実行されたSQL文が保存される。 SQL*PlusコマンドはSQLバッファに保存されない。 【SQL*Plusの編集コマンド】 ◆A (文字列)・・・原稿行の最後に文字列を追加する。 ◆CHANGE/(変更前の文字列)/(変更後の文字列)・・・原稿行の文字列を変更する。 →セパレータ("/"の部分)は他の文字を使用することもできる。 (例)C#HOGE#HOGE/HOGE・・・HOGEをHOGE/HOGEに変更 ◆DEL・・・原稿行を削除する。 ◆CLEAR BUFFER・・・バッファの保存されている内容を全て削除する。 ◆INPUT [(文字列)]・・・行を挿入する。 ◆LIST [m] [n]・・・バッファの内容を表示する。 ◆RUN・・・バッファ内のSQL文を実行する。 ◆n・・・現行行をn行目とする。 ◆/・・・バッファ内のSQL文を実行する。 13.5 SQL*Plusのファイルコマンド SQL*Plusには、コマンドファイル(スクリプトファイル)の作成と実行を行う機能がある。 【SQL*Plusのファイルコマンド】 ◆@(ファイル名)・・・ファイルの内容を実行する。 ◆START (ファイル名)・・・ファイルの内容を実行する。 ◆SAVE (ファイル名)・・・1SQLバッファの内容をファイルに保存する。 ◆GET (ファイル名)・・・ファイルの内容をSQLバッファにロードする。 ◆EDIT (ファイル名)・・・OSエディタを使用して、SQLバッファまたはファイルの内容を編集する。 13.6 SQL*Plusのスプール機能 SQL*Plusのスプール機能を使い、出力結果をファイルに記録できる。 【SPOOLコマンドの使用方法】 ◆SPOOL (ファイル名)・・・スプールを開始する。 ◆SPOOL OFF・・・スプールを停止する。 ◆SPOOL OUT・・・スプールを停止し、デフォルトプリンタで印刷する。 ◆SPOOL・・・現行行のスプール状態を表示する。
https://w.atwiki.jp/android/pages/43.html
チュートリアル:ノートパッドエクササイズ1 本エクササイズではシンプルなノートリストを作ります。このノートリストを使ってユーザは新規ノートを追加することができますが、ノートの編集を行うことはできません。本エクササイズでは以下の事項をデモンストレートします。 ListActivities の基本、メニューオプションの作成・操作の基本 SQLite データベース内のノートへのアクセス/保存方法 ArrayAdapter (ListView にバインドするためのもっともシンプルな方法の一つ)を用いてデータを ListView にバインドする方法 リストビューの配置の仕方やアクティビティメニューへのアイテムの追加のやり方、アクティビティがアクティビティメニューアイテムをどのように扱うか、といったスクリーンレイアウトの基本 [エクササイズ1] [エクササイズ2?] [エクササイズ3?] [追加事項?] Step 1 Notepadv1 プロジェクトを開きます。 Notepadv1 は開始点として提供されるプロジェクトです - it takes care of some of the boilerplate work that you have already seen if you followed the Hello Android tutorial (すでにHello Android(もしもしアンドロイド)のチュートリアルで見ているかもしれませんが、共通する説明があります。) 2. browse ボタンを押し、あなたが本エクササイズをコピーしたフォルダを選択し、その中からNotepadv1を選んでOKを押してください。 a. Package Explorer で右クリックし、New- Project... を選択してください。 b. Android/Android Project を選択し、Next を押してください。 c. New Android Project のダイアログで、Create project from existing source(既存のソースからプロジェクトを作成)を選択してください. d. browse ボタンを押し、あなたが本エクササイズをコピーしたフォルダを選択し、その中からNotepadv1を選んでOKを押してください。 e. Project name 欄に Notepadv1、Location 欄に選択したパスが表示されることを確認してください。 f. Finish を押します。 g. 本エクササイズのプロジェクトが Eclipse の Package Explorer に開かれ準備が完了します。 h. もし AndroidManifest.xml にエラー表示が出ていたり、Android の zipファイルに関連する問題が表示された場合は、プロジェクトの上で右クリックし、ポップアップから、Android Tools- Fix Project Properties を選択してください。(プロジェクトがライブラリの場所を正しく見ていないので、この操作でそれを修復します。) Step 2 データへのアクセスと更新について このエクササイズにおいては、単にSQLiteデータベースを直接使ってデータを保存しますが、実際のアプリケーションでは正当なContentProviderを作成し、処理をカプセル化する方がずっと良いでしょう。 もし興味があれば、content provider やデータの保存/検索/表示などに関する情報をいろいろと見つけることが出来るでしょう。 DBHelper クラスを見てみてください - このクラスは、我々が作成するノートのデータを保持するとともにその更新も可能にする、SQLiteへのデータアクセスをカプセル化するために提供されています。 典型的にはContentProviderを用いることでこのクラスを実装します。そして実際、SDKには行っている完全なNotepadアプリケーションはそのようなContentProviderを実装しています。しかし、我々がこれからするように、単にSQLiteデータベースを直接利用していけない理由はありません。このクラスについて注意すべき重要なことは、それがSQLiteデータベースのデータの保存、参照、更新の詳細の面倒をみてくれるということです。全ての行を取得するメソッド、行IDに基づいて行を取得するメソッド、新しい行を作成するメソッド、既存の行を削除するメソッド、既存の行を更新するメソッドがあります。もしあなた自身のアプリケーションでSQLiteデータベースを利用する方法に関する入門を希望なら、このクラスを見てみるか、より良くは、ContentProviderの利用例として SDK の samples/ ディレクトリに入っている完全なNotepadアプリケーションを見てみてください。 Step 3 Layout と activity とについて ほとんどのActivityはそれに関連付けられたレイアウトを持っています。レイアウトはユーザに対してそのactivityの「顔」となります。今回の例では我々のレイアウトは画面全体を覆いノートの一覧を提供します。 しかし、フルスクリーンレイアウトはActivityにとっての唯一の選択肢ではありません。フローティングレイアウト(たとえばダイアログとか警告のように)が欲しいこともあるでしょうし、レイアウトを全く必要としないこともあるでしょう(使用するレイアウトを決めない場合、activityはユーザに見えなくなります)。 Open the notepad_list.xml file in res/layout and take a look at it This is a layout definition file with a default starting point in it, we have provided this as a convenience to get you going quickly. 1. All Android layout files must start with the XML header line ?xml version="1.0" encoding="utf-8"? . 2. Also, the next definition will often (but not always) be a layout definition of some kind, in this case a LinearLayout. 3. Note also that the xml namespace of Android should always be defined in the top level component or layout in the XML so that android tags can be used through the rest of the file xmlns android="http //schemas.android.com/apk/res/android" Step 4 We need to create the layout to hold our list. Add code inside of the LinearLayout tag so the whole file looks like this (you may have to hit the Source tab in order to edit the XML file) ?xml version="1.0" encoding="utf-8"? LinearLayout xmlns android="http //schemas.android.com/apk/res/android" android layout_width="wrap_content" android layout_height="wrap_content" ListView id="@id/android list" android layout_width="wrap_content" android layout_height="wrap_content"/ TextView id="@id/android empty" android layout_width="wrap_content" android layout_height="wrap_content" android text="@string/no_notes"/ /LinearLayout 1. The ListView and TextView can be thought as two alternative views, only one of which will be displayed at once. ListView will be used when there are notes to be shown, while the TextView (which has a default value of "No Notes Yet!" defined as a string resource, will be displayed if there aren t any notes to display). 2. The @ in the id strings of the ListView and TextView means that the XML parser should parse and expand the rest of the id string and use an ID resource. 3. And, the android list and android empty are IDs that are already provided for us by the Android platform, empty is used automatically when no data is provided in the list adapter. The List Adapter knows to look for these names specifically by default. Alternatively you could also choose to change the default empty view used by the List Adapter by using the setEmptyView(). More broadly, the android.R class is a set of predefined resources provided for you by the platform, while your project s R class is the set of resources your project has defined. Resources found in the android.R resource class can be used in the XML files by using the android name space prefix (as we see here). Step 5 Resources and the R class The folders under res/ in the Eclipse project are special. There is a specific structure to the folders and files under this folder. In particular, resources defined in these folders and files will have corresponding entries in the R class allowing them to be easily accessed and used from your application. Furthermore, they will be bundled and deployed as part of the application. To make a list view, we also need to define a view for each row in the list 1. Create a new file under res/layout called notes_row.xml. 2. Add the following contents (note again the xml header is used, and the first node defines the Android xml namespace) ?xml version="1.0" encoding="utf-8"? TextView id="@+id/text1" xmlns android="http //schemas.android.com/apk/res/android" android layout_width="wrap_content" android layout_height="wrap_content"/ 3. This is the view that will be used for each notes title row — it has only one text field in it. 4. In this case we create a new id called text1. The + after the @ in the id string indicates that the id should be automatically created if it does not already exist, so we are defining text1 on the fly and then using it. 5. After saving this file, open the R.java class in the project and look at it, you should see new definitions for notes_row and text1 (our new definitions) meaning we can now gain access to these from the our code. Step 6 Next, open the Notepadv1 class in the source. We are going to alter this class to become a list adapter and display our notes, and also allow us to add new notes Notepadv1 will be a subclass of Activity called a ListActivity, which has extra functionality to accommodate the kinds of things you might want to do with a list, for example displaying an arbitrary number of list items in rows on the screen, moving through the list items, and allowing them to be selected. Take a look through the existing code in Notepadv1 class. There are some constant definitions at the top, followed by a private field we will use to create numbered note titles, and some overrides of methods from the superclass. Step 7 Change the inheritance of Notepadv1 from Activity to ListActivity public class Notepadv1 extends ListActivity Note you will have to import ListActivity into the Notepadv1 class using Eclipse, ctrl-shift-O on Windows or Linux, or cmd-shift-O on the Mac (organize imports) will do this for you. Step 8 There are already three override methods defined onCreate, onCreateOptionsMenu and onOptionsItemSelected, we need to fill these out * onCreate() is called when the activity is started — it is a little like the "main" method for the activity. We use this to set up resources and state for the activity when it is running * onCreateOptionsMenu() is used to populate the menu for the activity. This is shown when the user hits the menu button, and has a list of options they can select (like "Create Note") * onOptionsItemSelected() is the other half of the menu equation, it is used to handle events generated from the menu (e.g. when the user selects the "Create Note" item). Step 9 Fill out the body of the onCreate() method. Here we will set the title for the activity (shown at the top of the screen), use the notepad_list layout we have created for the activity display contents, set up the DBHelper instance we will use to access notes data, then populate the list with the available note titles 1. call super() with the icicle parameter passed into our method 2. setContentView to R.layout.notepad_list 3. Create a new private class field called dbHelper of class DBHelper (before the onCreate method) 4. Back in the onCreate method, construct a DBHelper instance — assign to the dbHelper field (note, you must pass this into the constructor for DBHelper) 5. Finally, call a new method -fillData()- gets the data and populates it using the helper, we haven t defined it yet 6. onCreate() should now look like this @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.notepad_list); dbHelper = new DBHelper(this); fillData(); } And remember to add the DBHelper field definition (right under the noteNumber definition) private DBHelper dbHelper; Step 10 More on menus The notepad application we are constructing only scratches the surface with menus. You can also add shortcut keys for menu items, create submenus and even add menu items to other applications!. Fill out the body of the onCreateOptionsMenu() method. We are going to add just one menu item for now, "Add Item", using a string we will create in strings.xml, and defined with a constant we will create at the top of the class to identify the Add Item operation. 1. In strings.xml resource (under res/values), add a new string for menu_insert with text "Add Item" string name="menu_insert" Add Item /string , then save the file 2. Also, you need a menu position constant at the top of the Notepadv1 class (right under the KEY_BODY definition) public static final int INSERT_ID = Menu.FIRST; 3. In the onCreateOptionsMenu() method, add the menu item. Also take care of the result of the super call being returned. The whole method should now look like this @Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, INSERT_ID, R.string.menu_insert); return result; } Step 11 Fill out the body of the onOptionsItemSelected() method This is going to handle our new "Add Note" menu item. When this is selected the onOptionsItemSelected() method will be called with the item.getId() set to INSERT_ID (the constant we used to identify the menu item). We can detect this, and take the appropriate actions 1. The super.onOptionsItemSelected(item) method call goes at the end of this method — we want to catch our events first! 2. Switch statement on item.getId() 3. case INSERT_ID 4. calls new method createNote() 5. break at the end of the case 6. return the result of the superclass onOptionsItemSelected() method at the end 7. The whole onOptionsItemSelect() method should now look like this @Override public boolean onOptionsItemSelected(Item item) { switch (item.getId()) { case INSERT_ID createNote(); break; } return super.onOptionsItemSelected(item); } Step 12 Add a new createNote() method In this first version of our application, createNote() is not going to be very useful. We will simply create a new note with a title assigned to it based on a counter ("Note 1", "Note 2"...) and with an empty body. At present we have no way of editing the contents of a note, so for now we will have to be content making one with some default values 1. String noteName = "Note " + noteNumber++; (Construct the name using "Note" and the counter we have defined in the class) 2. Call dbHelper.createRow() using noteName as the title and "" for the body 3. Call fillData() method again after adding (inefficient but simple) 4. The whole createNote() method should look like this private void createNote() { String noteName = "Note " + noteNumber++; dbHelper.createRow(noteName, ""); fillData(); } Step 13 List adapters Our example uses a very simple array adapter which binds an array or list of items into a ListView. More commonly in Android, List Adapters go hand in hand with ContentProviders, and this is also a very easy way to use lists. To bind a ContentProvider to a ListView you can use a android.widget.SimpleCursorAdapter to bind data from a ContentProvider into a ListView Define the fillData() method. This is fairly long This method uses ArrayAdapter, which is the simplest way of putting data into a ListView. ArrayAdapter takes either a List or an array of Strings, and binds them into a text view provided in the layout defined for the list row (this is the text1 field in our notes_row.xml layout). The method simply obtains a list of notes from the database helper, constructs a List of Strings using the title strings from each row, and then creates an ArrayAdapter out of those items and bound to use the notes_row we defined. private void fillData() { // We need a list of strings for the list items List String items = new ArrayList String (); // Get all of the rows from the database and create the item list List Row rows = dbHelper.fetchAllRows(); for (Row row rows) { items.add(row.title); } // Now create an array adapter and set it to display using our row ArrayAdapter String notes = new ArrayAdapter String (this, R.layout.notes_row, items); setListAdapter(notes); } 1. ArrayAdapter needs a List of Strings (List String ) containing the items to display 2. The data is read out of the database as rows, and the title field from each row is used to populate the list of strings 3. We specify the notes_row view we created as the receptacle for the data 4. If you get compiler errors about classes not being found, ctrl-shift-O or (cmd-shift-O on the mac) to organize imports. Note that for this exercise we use an ArrayAdapter, this is not a very scalable solution and more typically a SimpleCursorAdapter would be used with a ContentProvider or at least a Cursor returned from a query. See the sidebar on List Adapters for more information. Step 14 Run it! 1. Right click on the Notepadv1 project 2. From the popup menu, select Run As - Android Application 3. If you see a dialog come up, select Android Launcher as the way of running the application (you can also use the link near the top of the dialog to set this as your default for the workspace, this is recommended as it will stop the plugin from asking you this every time) 4. Add new notes by hitting the menu button and selecting Add Item from the menu Solution and Next Steps You can see the solution to this class in Notepadv1Solution from the zip file to compare with your own. Once you are ready, move on to Tutorial Exercise 2 to add the ability to create, edit and delete notes. Back to the Tutorial main page...
https://w.atwiki.jp/7699/pages/14.html
▼SQLServerDB間でデータコピー コピー先のテーブルが存在していないとダメ INSERT INTO [DB_B].[dbo].[TABLE1] SELECT * FROM [DB_A].[dbo].[TABLE1] コピー先のテーブルが存在していなくても、作ってくれる select * into xxxTBL_BACKUP from xxxTBL ▼BCPコマンド データのエクスポート C \ bcp databasename.dbo.tablename out c \tablename.csv -c -U sa -P ******* -t "," -T -S servername データのインポート C \ bcp databasename.dbo.tablename in c \tablename.csv -c -U sa -P ******* -t "," -T -S servername ▼SQLServerのDBのコピー手順と注意点 データベースのバックアップをとり、そのバックアップファイルを他の環境へ持っていき復元する 1.コピー元の環境でSQL Enterprise Managerを起動しDBに接続します。 2.対象のDBを選択し、右クリック→すべてのタスク→データベースのバックアップを選択します。 3.出力先の「追加」ボタンで出力するフォルダを選択します。 4.OKボタンでバックアップが開始されます。 5.ファイルをコピー先へ持ち込み、サーバの適当なフォルダにでもファイルを一時保存します。 6.コピー先の環境でSQL Enterprise Managerを起動しDBに接続します。 7.DBが未作成であれば新規作成します。 8.復元するDBを選択し右クリック→すべてのタスク→データベースの復元を選択します。 9.「復元:デバイスから」をチェックします。 10.デバイス選択ボタンでバックアップファイルを置いたフォルダにアクセスしファイルを選択します。 11.オプションタブで「既存のデータベース上に強制的に復元」をチェックします。 12.そして論理ファイル名と物理ファイル名が表示されているグリッド部の物理ファイル名と そのパスをよくチェックして下さい。 ここがコピー元環境と違っているにもかかわらず、そのまま実行すると、 デバイス アクティブ化エラー ・・・ WITH MOVEオプションを使用します・・・ RESTORE DATABASEが異常終了しました。 とエラーになります。 ミソは9でファイルからの復元が可能となる事、12に注意する事です。 ここをおさえておけばすんなり復元できるかと思います。 補足: その他にデタッチ&アタッチによる方法もありますが、こちらは一時的にDBが使用できなくなるので、 DBの使用者がいれば迷惑がかかります。 DBを丸ごと別のPCに移す場合等はこちらの方法が楽です。 コピー元PCとコピー先PCが同LAN内にある場合は、 データのエクスポート&インポートでも実現可能です。
https://w.atwiki.jp/keiplus/pages/107.html
SQL基礎 テスト用に使うデータは「データカタログサイト(http //www.data.go.jp/)」を紹介します。 テスト用データをSQLツールやスクリプトを組んで作ることは可能です。しかしアプリの挙動を 確認するためでなければわざわざ手間暇かける必要はないと思います。 郵便番号なら10万件あり、DLに時間はかかりますが作る時間を考えると遥かに短時間で用意できます。 DML(Data Manipulation Language):データ操作(クエリ処理の部分) Select, Insert, Update, Delete DDL(Data Definition Language):データ定義(テーブル定義書) Create, Drop, Alter DCL(Data Control Language):データ制御(ユーザ設定、DB設定) Grant, Revoke, Commit, Rollback 句 From, Oder by, Where, Exists, Group by, Having, AS With, RECURSIVE 演算子 Like,
https://w.atwiki.jp/skmt200x/pages/103.html
PostgreSQLデータベースの管理などに関する、俯瞰。 現在8.3を運用で使っているため、8.3ベースで記載しているものの、上位バージョンでも基本的には使用可能と思われる。 プログラムバージョンの確認 データベースデータベースの確認 接続の確認および変更 データベースの作成 データベースの変更 データベースの削除 データベースのバックアップ(ダンプ) データベースのリストア ユーザ(ロール)ユーザ(ロール)の確認 ユーザ(ロール)の作成 ユーザ(ロール)の変更 ユーザ(ロール)の削除 スキーマスキーマの確認 スキーマの作成 スキーマの削除 その他、スキーマの使われ方等public スキーマ スキーマ検索パス スキーマ検索パスの設定 TOPへ編集 プログラム バージョンの確認 以下のコマンドにて、インストールされているバージョンを確認する。 postgres --version (出力例) postgres (PostgreSQL) 8.3.11 TOPへ編集 データベース データベースの確認 psqlコマンドを起動した後、メタコマンド\lにて確認を行う。 (実行例) \l (出力例) List of databases Name | Owner | Encoding -----------+----------+---------- postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 testdb | postgres | UTF8 (4 rows) 接続の確認および変更 psqlコマンドを起動した後、メタコマンド\cで接続の確認、および変更を行う。 (実行例:接続の確認) \c (出力例) You are now connected to database "postgres". (実行例:接続の変更) \c testdb (出力例) You are now connected to database "testdb". データベースの作成 以下のSQLを実行して、データベースを作成します。 CREATE DATABASE データベース名 WITH options...; (出力例) CREATE DATABASE options... OWNER 所有者ロール 通常はpostgres TEMPLATE テンプレート 通常はDEFAULT(template1) ENCODING 文字コード 通常はDEFAULT(UTF-8)※多分OSの環境変数LANG TABLESPACE テーブルスペース 通常はDEFAULT CONNECTION LIMIT 同時接続数 デフォルトは-1(無制限) あるいは、シェルから以下のコマンドを実行します。 createdb データベース名 データベースの作成詳細は 参考 http //www.postgresql.jp/document/8.3/html/manage-ag-createdb.htmlを参照すること。 データベースの変更 以下のSQLを実行して、データベースを変更します。 ALTER DATABASE データベース名 WITH options...; (出力例) ALTER DATABASE データベースの変更詳細は、参考 http //www.postgresql.jp/document/8.3/html/sql-alterdatabase.htmlを参照してください。 データベースの削除 以下のSQLを実行して、データベースを削除します。 DROP DATABASE データベース名; (出力例) DROP DATABASE あるいは、シェルから以下のコマンドを実行します。 dropdb データベース名 データベースの削除詳細は、参考 http //www.postgresql.jp/document/8.3/html/manage-ag-dropdb.htmlを参照すること。 データベースのバックアップ(ダンプ) 単純には、以下のコマンドで、バックアップを取得する。 pg_dump データベース名 -f データベースダンプ名 単純なこの方法では、多少制限もあるため、 もう少し調べた内容については、別途PostgreSQL/A-1.バックアップとリストアを参照すること。 データベースのリストア 概要的には、一度データベースを再作成して、バックアップ(ダンプ)しておいた内容を復元する。 dropdb データベース名; createdb データベース名; psql testdb -f データベースバックアップ(ダンプ)ファイル名 もう少し調べた内容については、別途PostgreSQL/A-1.バックアップとリストアを参照すること。 この方法によるリストアの制限について、参考 http //www.postgresql.jp/document/8.3/html/backup-dump.htmlを参照すること。 主に、ロールやテーブル空間などはダンプされない(データベースクラスタ全体で保持している情報のため)。 TOPへ編集 ユーザ(ロール) PostgreSQLではロールとも呼ばれる。 データベースオブジェクトの所有者になったりする。 データベース接続への認証にもユーザ(ロール)は使われるが、PostgreSQLではクライアント認証に、いくつかの段階を経て認証を行うため、ユーザ(ロール)を追加しただけでは、設定は完結しない。 詳細は参考 http //www.postgresql.jp/document/8.3/html/auth-pg-hba-conf.htmlを参照すること。 ユーザ(ロール)の確認 psqlコマンドを起動した後、メタコマンド\duにて確認を行う。 (実行例) \du List of roles Role name | Superuser | Create role | Create DB | Connections | Member of -----------+-----------+-------------+-----------+-------------+----------- postgres | yes | yes | yes | no limit | {} test | no | no | no | no limit | {} (2 rows) あるいは以下のSQL SELECT rolname FROM pg_roles; (実行例) rolname ---------- postgres test (2 rows) ユーザ(ロール)の作成 以下のSQLにてユーザ(ロール)を作成します。 CREATE ROLE ユーザ名; (例)パスワード認証が必要な、ログイン可能なユーザ(ロール)の作成 CREATE ROLE test WITH NOSUPERUSER LOGIN PASSWORD password ; 作成操作の詳細は 参考 http //www.postgresql.jp/document/8.3/html/sql-createrole.html を参照すること。 ユーザ(ロール)の変更 以下のSQLにてユーザ(ロール)を変更します。 ALTER ROLE ユーザ名 WITH option... (例)パスワードの変更 ALTER ROLE test WITH PASSWORD NewPassword ; 変更操作の詳細は 参考 http //www.postgresql.jp/document/8.3/html/sql-alterrole.html を参照すること。 ユーザ(ロール)の削除 以下のSQLにてユーザ(ロール)を削除します。 DROP ROLE ユーザ名; TOPへ編集 スキーマ スキーマを使うことで、データベース内に同じテーブル名を使うことが可能になる。 厳密には、スキーマによって別のテーブルとして扱われる。 論理的な構造としては、 データベース スキーマ テーブル というような感じ。 参考 http //www.postgresql.jp/document/8.3/html/ddl-schemas.html スキーマの確認 psqlコマンドを起動した後、\dnメタコマンドにて確認を行う。 (実行例) \dn List of schemas Name | Owner --------------------+---------- information_schema | postgres pg_catalog | postgres pg_toast | postgres pg_toast_temp_1 | postgres public | postgres test1 | postgres (6 rows) スキーマの作成 以下のSQLで定義する。 CREATE SCHEMA スキーマ名; スキーマの削除 以下のSQLで削除する。 DROP SCHEMA スキーマ名; オブジェクトを含む場合、以下の構文で削除する。 DROP SCHEMA スキーマ名 CASCADE; その他、スキーマの使われ方等 public スキーマ スキーマ名を指定しないで作成したテーブルは、publicスキーマとして作成されています。 スキーマ検索パス スキーマ名を記載しない場合に、検索する順序がある。 以下のコマンドで確認。 SHOW search_path; (出力例) postgres=# SHOW search_path; search_path ---------------- "$user",public (1 row) スキーマ検索パスの設定 以下のコマンドで設定 SET search_path TO test1,public; TOPへ編集 最終更新日 [2011-04-12]